import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';

// 路由信息
const routes: RouteRecordRaw[] = [
  {
    path: '/',
    redirect: '/login',
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login/login.vue'),
  },
  {
    path: '/index',
    name: 'index',
    component: () => import('@/views/index/index.vue'),
    children: [
      {
        path: '',
        component: () => import('@/views/recommend/recommend.vue'),
      },
      {
        path: 'home',
        name: 'home',
        component: () => import('@/views/home/home.vue'),
      },
      {
        path: 'found',
        name: 'found',
        component: () => import('@/views/found/found.vue'),
      },
      {
        path: 'recommend',
        name: 'recommend',
        component: () => import('@/views/recommend/recommend.vue'),
        children: [
          {
            path: 'gexingtuijian',
            name: 'gexingtuijian',
            component: () =>
              import('@/views/recommend/gexingtuijian/gexingtuijian.vue'),
          },
          {
            path: 'gedan',
            name: 'gedan',
            component: () => import('@/views/recommend/gedan/gedan.vue'),
          },
          {
            path: 'zhubodiantai',
            name: 'zhubodiantai',
            component: () =>
              import('@/views/recommend/zhubodiantai/zhubodiantai.vue'),
          },
          {
            path: 'paihangbang',
            name: 'paihangbang',
            component: () =>
              import('@/views/recommend/paihangbang/paihangbang.vue'),
          },
        ],
      },
      {
        path: 'songlist',
        name: 'songlist',
        component: () => import('@/views/songlist/index.vue'),
        meta: {
          isHideTop: true,
        },
      },
    ],
  },
];

// 导出路由
const router = createRouter({
  history: createWebHistory(),
  routes,
});

/* router.beforeEach((to, from, next) => {
    let
    // ...
    // explicitly return false to cancel the navigation
    return false
}) */

export default router;
